const LApp = getApp();

// pages/operat/origins/originHandleTask/originHandleTask.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    nodeId:0,
    nodesModel:{},
    productModel: {},
    nodeName:"",
    display:"",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let model = LApp.pages.get("origins/origins").data.model;
    if (model) {
      this.setData({
        nodeId: model.Id,
        productModel: model
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getNodesInfo();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  //节点任务填写
  goOriginTaskEdit: function (e) {
    let nodesModel = e.currentTarget.dataset.item;
    if (nodesModel){
      if (nodesModel.NodeType == 0) {
        nodesModel.FlowID = this.data.nodeId;
        nodesModel.Id = 0;
      }
     this.setData({
     nodesModel: nodesModel,
   })
   LApp.pages.add(this);
   wx.navigateTo({
     url: "../originTaskEdit/originTaskEdit",
   })
    }
   // LApp.openView("../originTaskEdit/originTaskEdit");
  },
  //get 节点信息
  getNodesInfo:function()
  {
    let _this = this;
    LApp._get({
      url: 'nbapi/originsTask/origins/getNodelist',
      data: {
        batchId: this.data.nodeId},
      success: function (r) {
        _this.setData({
          NodesList: r
        })
      }
    })  
  },
 
})